
$(function(){
  var type = {
    POST:'post',
    GET:'get',
    DELETE:'delete',
    PUT:'put',
    PATCH:'patch'
  };
  var fun = function () {};
  // ajax封装
  function ajax(url, param, success, error, type) {
    $.ajax({
      type: type,
      url: url,
      headers : {
        'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'
      },
      data: param,
      dataType: 'json',
      success: success,
      error: error
    });
  }
  var http = {
    get:function(url,param,success,error){
      ajax(url,param,success || fun,error || fun,type.GET)
    },
    post:function(url,param,success,error){
      ajax(url,param,success || fun,error || fun,type.POST)
    },
    put:function(url,param,success,error){
      ajax(url,param,success || fun,error || fun,type.PUT)
    },
    patch:function(url,param,success,error){
      ajax(url,param,success || fun,error || fun,type.PATCH)
    }
  };
  var httpRouter = new (function () {
    this.ApiVersion = 'v1/';
    // server url
    //private ApiUrl = 'http://l.phph5.com/api/';
    this.private ApiUrl = 'http://xdm.mengzhudai.com/api/';
    // test url
    //private ApiUrl = 'http://172.31.152.105:8081/api/allianz/phoenix/' + this.ApiVersion;



    this.sendSms = this.ApiUrl + 'sms/send';
    this.setPhone = this.ApiUrl + 'customer/step1';
    this.setInfo = this.ApiUrl + 'customer/step2';
    this.getProductList = this.ApiUrl + 'product/lists';
    this.getProductDetails = this.ApiUrl + 'product/detail';
    this.setOrder = this.ApiUrl + 'product/order';

    this.logIn = this.ApiUrl + 'commissioner/login';
    this.regist = this.ApiUrl + 'commissioner/register';
    this.resetpwd = this.ApiUrl + 'commissioner/resetpwd';
    this.getUser = this.ApiUrl + 'commissioner/getcommissioner';
    this.danList = this.ApiUrl + 'customer/lists';
    this.quanju = this.ApiUrl + 'customer/quanju';
    this.userDetail = this.ApiUrl + 'customer/detail';
    this.region = this.ApiUrl + 'region/lists';
    this.records = this.ApiUrl + 'commissioner/records';
    this.orderList = this.ApiUrl + 'commissioner/orderlists';
    this.createorder = this.ApiUrl + 'commissioner/createorder';
    this.edit = this.ApiUrl + 'commissioner/edit';

    this.commissioner = this.ApiUrl + 'upload/commissioner';
    this.certification = this.ApiUrl + 'commissioner/certification';

    this.datasuv = 'http://api.datasuv.net/data/add?m=Ml8xXzMyOV8yNzY=';
    this.ocdc = "http://ocdc.fang-crm.com/api/index/add?key=4trhDV4oQ4CDuzJOvnachMITYgdChPgPevmBhZUw";
    this.dataduke = function(c,v){
      return "http://dc.szduke.cn/api/loan/reg?c="+c+"&t=loan&v="+v+"&b=mobile"
    };

    this.log = this.ApiUrl + "customer/log";
    this.orderremark = this.ApiUrl + 'commissioner/orderremark';

  });
})
